package com.zl.invoke;


import java.lang.reflect.Constructor;

import com.ls.fw.sys.auth.model.SysUserAccount;

public class A {

	public A() {

	}

	public A(String str) {

	}

	class Inner {
		private String name = "Inner";

		public Inner() {
		}

		public Inner(String na) {
			name = na;
		}
	}

	public static void main(String args[]) throws  Exception, IllegalAccessException {
		SysUserAccount dAccount = new SysUserAccount();
		String dString = dAccount.getName()+"$Columns";
		 Class[] innercla=dAccount.getClass().getDeclaredClasses();
		  for(Class cl:innercla){
		   System.out.println(cl.getField("FIELD_MAP").get(cl));

		  }
		Object obj = getObject("com.zl.invoke.A");
		System.out.println("obj: " + obj.toString());
		Object innerObj = getObjectFromInnerClass("com.zl.invoke.A$Inner");
		System.out.println("innerObj : " + innerObj.toString());
	}

	public static Object getObject(String className) {
		Object obj = null;
		try {
			Class c = Class.forName(className);
			if (c != null) {
				Constructor constructor = c
						.getDeclaredConstructor(new Class[] { String.class });
				if (constructor != null) {
					obj = constructor.newInstance("dlafjdf");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return obj;
	}

	public static Object getObjectFromInnerClass(String clsName) {
		Object obj = null;
		try {
			Class c = Class.forName(clsName);
			if (c != null) {
				Constructor constructor = c.getDeclaredConstructor(new Class[] {
						A.class, String.class });
				if (constructor != null) {
					obj = constructor.newInstance(new A(), "dlafjdf");
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return obj;
	}
}
